<?xml version="1.0" encoding="utf-8"?>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>


<!DOCTYPE html>

<html lang="en">
<head>
<title>Flight Search</title>
<link rel="stylesheet" type="text/css" href="css/site.css">
<link rel="stylesheet" type="text/css" href="css/flightSearchQuery.css">
<link rel="stylesheet" type="text/css" href="css/styles.css">
<script src="scripts/script.js"></script>
<style type="text/css">
BODY,P,TD {
	font-family: Arial, Verdana, Helvetica, sans-serif;
	font-size: 10pt
}

A {
	font-family: Arial, Verdana, Helvetica, sans-serif;
}

B {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	font-weight: bold;
}

.error_strings {
	font-family: Verdana;
	font-size: 14px;
	color: #660000;
}

.left {
	background-color: Red;
	float: left;
	width: 30%;
	height: 30px;
}

.right {
	background-color: Aqua;
	margin-left: 30%;
	height: 30px;
}
</style>
<script src="scripts/gen_validatorv4.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="css/site.css">
<link rel="stylesheet"
	href="//code.jquery.com/ui/1.11.1/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.1/jquery-ui.js"></script>
<script type='text/javascript'>
	$(function() {
		$("#header").load("header.html");
	});
</script>
<script>
	$(function() {
		$("#datepicker").datepicker({
			minDate : 0
		});
	});
</script>
</head>

<body>
<c:if test="${empty sessionScope.user}">
  	<c:redirect url="Login.jsp"/>
</c:if>

<div><%@include file="/WEB-INF/header.jsp" %></div>
<br>
	<div class="content-wrapper">
		<div id="body" style="background:;" >
			<section class="container">
				<div class="login">
					<h1>Flight Search Query</h1>
					
					<c:url value="FlightSearchQuery" var="encodedURL">  
    				</c:url>  
  
					
					<form action="${encodedURL}" name="myform" id="myform"
						method="post">
						
						<table>
							<tr>
								<td>Departure:</td>
								<td><input type="text" name="departure" /></td>
							</tr>
							<tr>
								<td>Destination:</td>
								<td><input type="text" name="destination" /></td>
							</tr>
							<tr>
								<td>Date of Travel:</td>
								<td><input type="text" id="datepicker" name="date" /></td>
							</tr>

							<tr>
								<td>Number of Seats:</td>
								<td><input type="number" value="" name="seats"
									min="1" max="100" /></td>
							</tr>
							<tr>
								<td>Class:</td>
								<td><select id="Class" name="class">
										<option value="000" selected="selected"></option>
										<option value="Economy">Economy</option>
										<option value="Business">Business</option>
										<option value="First Class">First Class</option>

								</select></td>
							</tr>

							<tr>
								<td></td>
								<td>
									<div id="myform_errorloc" class="error_strings"></div>
								</td>
							</tr>
						</table>
						<p>
							<input type="submit" name="Search" value="Search" class="button" />
						</p>
					</form>
					<br>
					<c:url value="BookingHistory" var="encodedURLBooking"></c:url> 
					<form name="BookingHistory" method="post" action="${encodedURLBooking}">
						<p>
							<input type="submit" value="Booking History" class="button" />
						</p>
					</form>
				</div>
			</section>
		</div>
	</div>

	<script type="text/javascript">
		//<![CDATA[
		//You should create the validator only after the definition of the HTML form
		var frmvalidator = new Validator("myform");
		frmvalidator.EnableOnPageErrorDisplaySingleBox();
		frmvalidator.EnableMsgsTogether();

		frmvalidator.addValidation("Departure", "req",
				"Please enter the City for your Departure");
		frmvalidator.addValidation("Departure", "maxlen=20",
				"Max length for Departure is 20");
		frmvalidator.addValidation("Departure", "alpha_s",
				"The Departure can contain alphabetic chars only");

		frmvalidator.addValidation("Destination", "req",
				"Please enter the City for your Destination");
		frmvalidator.addValidation("Destination", "maxlen=20",
				"Max length for Destination is 20");
		frmvalidator.addValidation("Destination", "alpha_s",
				"The Destination can contain alphabetic chars only");

		frmvalidator.addValidation("Date", "req",
				"Please enter the Date of your trip");
		frmvalidator.addValidation("Date", "maxlen=20",
				"Max length for Date is 20");

		frmvalidator.addValidation("Seats", "req",
				"Please enter the number of seats that you want");
		frmvalidator.addValidation("Seats", "maxlen=50");
		frmvalidator.addValidation("Seats", "numeric");

		frmvalidator.addValidation("Class", "dontselect=000");
		//]]>
	</script>
</body>
</html>
